package com.songlanyun.modules.offlineorder.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.songlanyun.modules.offlineorder.entity.OfflineOrder;
import com.songlanyun.modules.offlineorder.service.OfflineOrderService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 * 线下商家上报订单
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2023-02-11 16:57:11
 */
@RestController
@RequestMapping("admin/offlineorder")
public class OfflineOrderAdminController extends AbstractController {
    @Autowired
    private OfflineOrderService offlineOrderService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    //@RequiresPermissions("offlineorder:offlineorder:list")
    public R page(@RequestParam Map<String, Object> params){
        params.put("area_agent_id",getAreaAgentId());
        PageUtils page = offlineOrderService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("offlineorder:offlineorder:info")
    public R info(@PathVariable("id") Long id){
		OfflineOrder offlineOrder = offlineOrderService.getById(id);
        offlineOrder.loadShop();
        offlineOrder.loadIncomes();
        offlineOrder.loadComments();

        return R.ok().put("offlineOrder", offlineOrder);
    }



}
